const mysql = require('mysql')
// mysql 怎么简历连接对象
const con = mysql.createConnection({
    host: "localhost",
    port: "3306",
    user: "root",
    password: "root",
    database: "blog"
})

con.connect()

function query(sql) {
    return new Promise((resolve, reject) => {
        con.query(sql, (err, data) => {
            if (err) reject(err)
            resolve(data)
        })
    })
}

module.exports = query;